package chixing.day14.homework.work3;

import java.util.HashMap;
import java.util.Map;

public class PhoneBookTest {
    static HashMap<String, Long> phoneBook = new HashMap<>();

    static {
        phoneBook.put("Tom", 18627395555L);
        phoneBook.put("Jerry", 1923833333L);
        phoneBook.put("Alice", 13789439999L);
    }

    public static void main(String[] args) {
        System.out.println(getPhoneNo("tom"));
        System.out.println(getPhoneNo("Tom"));
    }


    public static Long getPhoneNo(String userName) {
        for (Map.Entry<String, Long> entry : phoneBook.entrySet()) {
            if (entry.getKey().equals(userName)) {
                return entry.getValue();
            }
        }
            System.out.println("not find");
        return null;
    }

}
